import { ColumnGroupType, ColumnType } from "antd/es/table"

import TooltipText from "@/components/common/tooltipText"
import { handleNumber, handleNumberColor } from "@/utils/util"

const AgentWithdrawalReviewRecordColumns = (
	newFormat: (arg: string) => string,
	getFromDic: (arg: string, strictlyLabel?: boolean) => any,
	getLabel: (value: string | number, modal: string, strictlyLabel?: boolean, customDictArr?: any[]) => any
): Record<string, ColumnGroupType<any> | ColumnType<any>> => ({
	// const columns1 = {
	agentWithdrawalDetail_createdAt: {
		title: newFormat("funds.fund_audit.register_time"),
		dataIndex: "createdAt",
		align: "center",
		render: (text: string) => text || "-"
	},
	agentWithdrawalDetail_lastLoginDatetime: {
		title: newFormat("funds.fund_audit.last_login_datetime"),
		dataIndex: "lastLoginDatetime",
		align: "center",
		render: (text: string) => text || "-"
	},
	agentWithdrawalDetail_registryAppTypeStr: {
		title: newFormat("funds.fund_audit.registry_app_type"),
		dataIndex: "registryAppTypeStr",
		align: "center",
		render: (text: string) => text || "-"
	},
	agentWithdrawalDetail_parentProxyName: {
		title: newFormat("funds.fund_audit.parent_proxy_name"),
		dataIndex: "parentProxyName",
		align: "center",
		render: (text: string) => text || "-"
	},

	agentWithdrawalDetail_merchantName: {
		title: newFormat("common.belong_merchant"),
		dataIndex: "merchantName",
		align: "center",
		render: (text: string, record: any) => (record.merchantId ? getLabel(record.merchantId, "merchantList") : text || "-")
	},
	agentWithdrawalDetail_loginLockStatus: {
		title: newFormat("common.account_status"),
		dataIndex: "loginLockStatus",
		align: "center",
		render: (text: string, record: any) => (
			<>
				{record.loginLockStatus === 1 && <span className="disableRgba">{newFormat("common.login_lock_status")}</span>}
				{record.paymentLockStatus === 1 && <span className="deleteRgba">{newFormat("common.account_lock_status")}</span>}
				{record.loginLockStatus === 0 && record.paymentLockStatus === 0 && (
					<span className="normalRgba">{newFormat("common.account_status_normal")}</span>
				)}
			</>
		)
	},

	// const columns3 = {
	agentWithdrawalDetail_accountWindControl: {
		title: newFormat("funds.fund_audit.proxy_account_wind_control"),
		dataIndex: "accountWindControl",
		align: "center",
		render: (text: string) => <span className={text !== "否" && text ? "red" : ""}>{text || "-"}</span>
	},
	agentWithdrawalDetail_bankcardWindControl: {
		title: newFormat("funds.fund_audit.bankcard_wind_control"),
		dataIndex: "bankcardWindControl",
		align: "center",
		render: (text: string) => <span className={text !== "否" && text ? "red" : ""}>{text || "-"}</span>
	},
	agentWithdrawalDetail_virtualAccountWindControl: {
		title: newFormat("funds.fund_audit.virtual_account_wind_control"),
		dataIndex: "virtualAccountWindControl",
		align: "center",
		render: (text: string) => <span className={text !== "否" && text ? "red" : ""}>{text || "-"}</span>
	},
	agentWithdrawalDetail_ipWindControl: {
		title: newFormat("funds.fund_audit.ip_wind_control"),
		dataIndex: "ipWindControl",
		align: "center",
		render: (text: string) => <span className={text !== "否" && text ? "red" : ""}>{text || "-"}</span>
	},
	agentWithdrawalDetail_deviceNoWindControl: {
		title: newFormat("funds.fund_audit.device_no_wind_control"),
		dataIndex: "deviceNoWindControl",
		align: "center",
		render: (text: string) => <span className={text !== "否" && text ? "red" : ""}>{text || "-"}</span>
	},

	// const columns41 = {
	agentWithdrawalDetail_lastWithdrawTime: {
		title: newFormat("funds.fund_audit.last_withdraw_time"),
		dataIndex: "lastWithdrawTime",
		align: "center",
		render: (text: string) => text || "-"
	},
	agentWithdrawalDetail_lastWithdrawAmountUsdt: {
		title: newFormat("funds.fund_audit.last_withdraw_amount"),
		dataIndex: "lastWithdrawAmountUsdt",
		align: "center",
		render: (text: string, record: any) => (
			<>
				<span>{handleNumber(record.symbolUsdt, record.lastWithdrawAmountUsdt)}</span>
				<br />
				{record.lastWithdrawType === 1 && <span>({handleNumber(record.symbolCny, record.lastWithdrawAmountCny)})</span>}
			</>
		)
	},
	agentWithdrawalDetail_lastWithdrawStatus: {
		title: newFormat("funds.fund_audit.last_withdraw_status"),
		dataIndex: "lastWithdrawStatus",
		align: "center",
		render: getFromDic("withdrawOrderStatus", false)
	},
	agentWithdrawalDetail_lastWithdrawType: {
		title: newFormat("funds.fund_audit.last_withdraw_type"),
		dataIndex: "lastWithdrawType",
		align: "center",
		render: (_text: string, record: any) =>
			record.lastWithdrawType || record.lastWithdrawType === 0
				? getLabel(record.lastWithdrawType, "withdrawPaymentTypeArr", false)
				: "-"
	},
	agentWithdrawalDetail_lastWithdrawChannel: {
		title: newFormat("funds.fund_audit.last_withdraw_channel"),
		dataIndex: "lastWithdrawChannel",
		align: "center",
		render: (text: string) => text || "-"
	},

	// const columns42 = {
	agentWithdrawalDetail_totalDeposit: {
		title: newFormat("funds.fund_audit.total_deposit"),
		dataIndex: "totalDeposit",
		align: "center",
		render: (_text: string, record: any) =>
			record.totalDeposit || record.totalDeposit === 0 ? handleNumber(record.currency, record.totalDeposit) : "-"
	},
	agentWithdrawalDetail_totalDepositNum: {
		title: newFormat("funds.fund_audit.total_deposit_num"),
		dataIndex: "totalDepositNum",
		align: "center",
		render: (_text: string, record: any) =>
			record.totalDepositNum || record.totalDepositNum === 0 ? record.totalDepositNum : "-"
	},
	agentWithdrawalDetail_totalWithdraw: {
		title: newFormat("funds.fund_audit.total_withdraw"),
		dataIndex: "totalWithdraw",
		align: "center",
		render: (_text: string, record: any) =>
			record.totalWithdraw || record.totalWithdraw === 0 ? handleNumber(record.currency, record.totalWithdraw) : "-"
	},
	agentWithdrawalDetail_totalWithdrawNum: {
		title: newFormat("funds.fund_audit.total_withdraw_num"),
		dataIndex: "totalWithdrawNum",
		align: "center",
		render: (_text: string, record: any) =>
			record.totalWithdrawNum || record.totalWithdrawNum === 0 ? record.totalWithdrawNum : "-"
	},
	agentWithdrawalDetail_totalDepositWithdrawSub: {
		title: newFormat("funds.fund_audit.total_deposit_withdraw_sub"),
		dataIndex: "totalDepositWithdrawSub",
		align: "center",
		render: (_text: string, record: any) =>
			record.totalDepositWithdrawSub || record.totalDepositWithdrawSub === 0
				? handleNumber(record.currency, record.totalDepositWithdrawSub)
				: "-"
	},

	// const columns51 = {
	agentWithdrawalDetail_eventIdFunds: {
		key: "eventId",
		align: "center",
		dataIndex: "eventId",
		title: newFormat("funds.order_no"),
		render: (text: string) => (text ? <TooltipText text={text} /> : "-"),
		width: 280
	},
	agentWithdrawalDetail_appTypeStr: {
		title: newFormat("funds.fund_audit.app_type"),
		dataIndex: "appTypeStr",
		align: "center",
		render: (text: string) => text || "-"
	},
	agentWithdrawalDetail_ip: {
		title: newFormat("funds.fund_audit.ip"),
		dataIndex: "ip",
		align: "center",
		render: (text: string) => text || "-"
	},
	agentWithdrawalDetail_deviceNo: {
		title: newFormat("funds.fund_audit.deviceNo"),
		dataIndex: "deviceNo",
		align: "center",
		render: (text: string) => (text ? <TooltipText text={text} /> : "-")
	},
	agentWithdrawalDetail_firstWithdrawStatus: {
		title: newFormat("funds.fund_audit.first_withdraw_status"),
		dataIndex: "firstWithdrawStatus",
		align: "center",
		render: (text: number) => (
			<span className={text !== 0 ? "red" : ""}>{text === 0 ? newFormat("common.no") : newFormat("common.yes")}</span>
		)
	},
	agentWithdrawalDetail_bigWithdraw: {
		title: newFormat("funds.fund_audit.big_withdraw"),
		dataIndex: "bigWithdraw",
		align: "center",
		render: (text: number | undefined) => (
			<span className={text !== 0 ? "red" : ""}>
				{text === 0 ? newFormat("common.no") : text ? newFormat("common.yes") : "-"}
			</span>
		)
	},
	// table 52
	agentWithdrawalDetail_withdrawType: {
		title: newFormat("funds.fund_audit.withdraw_type"),
		dataIndex: "withdrawType",
		align: "center",
		render: (text: number) => (text || text === 0 ? getLabel(text, "withdrawPaymentType", false) : "-")
	},
	agentWithdrawalDetail_channelName: {
		title: newFormat("funds.fund_audit.sub_pay_type"),
		dataIndex: "channelName",
		align: "center",
		render: (text: string) => text || "-"
	},
	agentWithdrawalDetail_withdrawCount: {
		title: newFormat("funds.fund_audit.withdraw_count_canWithdraw_count"),
		align: "center",
		render: (text: any, record: any) => (
			<>
				{record.todayWithdrawCount}/{record.todayCanWithdrawCount || "-"}
			</>
		)
	},
	agentWithdrawalDetail_withdrawAmount: {
		title: newFormat("funds.fund_audit.withdraw_amount_canWithdraw_amount"),
		align: "center",
		render: (text: any, record: any) => (
			<>
				{record.todayWithdrawAmount !== undefined && record.todayWithdrawAmount !== null
					? handleNumber(record.currency, record.todayWithdrawAmount)
					: "-"}
				/
				{record.todayCanWithdrawAmount !== undefined && record.todayCanWithdrawAmount !== null
					? handleNumber(record.currency, record.todayCanWithdrawAmount)
					: "-"}
			</>
		)
	},
	agentWithdrawalDetail_withdrawInfo: {
		title: newFormat("funds.fund_audit.withdraw_info"),
		dataIndex: "withdrawInfo",
		align: "center",
		render: (text: string) => (text ? <TooltipText text={text} /> : "-")
	},
	agentWithdrawalDetail_orderAmount: {
		title: newFormat("funds.fund_audit._order_amount"),
		align: "center",
		render: (text: any, record: any) => (
			<>
				<span style={{ color: "red", fontSize: "18px", fontWeight: 600 }}>
					{handleNumber(record.symbolUsdt, record.orderAmountUsdt)}
				</span>
				<br />
				{record.withdrawType === 1 && (
					<span style={{ color: "red", fontSize: "18px", fontWeight: 600 }}>
						{handleNumber(record.symbolCny, record.orderAmountCny)}
					</span>
				)}
			</>
		)
	},

	// table 61
	agentWithdrawalDetail_withdrawLimitType: {
		align: "center",
		title: newFormat("funds.capital_adjustment.withdraw_limit_type"),
		dataIndex: "billing_restrictions",
		key: "billing_restrictions",
		render: () => <span>{newFormat("funds.fund_audit.billing_restrictions")}</span>
	},
	agentWithdrawalDetail_remainAmount: {
		align: "center",
		title: newFormat("funds.capital_adjustment.remain_amount"),
		dataIndex: "remainAmount",
		render: (text: string, record: any) => <span>{handleNumber(record.currency, text)}</span>
	},

	// table 62
	agentWithdrawalDetail_withdrawLimitType1: {
		align: "center",
		title: newFormat("funds.capital_adjustment.withdraw_limit_type"),
		dataIndex: "flow_restriction",
		render: () => <span>{newFormat("funds.fund_audit.flow_restriction")}</span>
	},

	agentWithdrawalDetail_validAmount: {
		align: "center",
		title: (
			<>
				{newFormat("funds.capital_adjustment.need_valid_water")}
				<br />
				{newFormat("funds.capital_adjustment.withdraw_snoshop")}
			</>
		),
		dataIndex: "validAmount",
		render: (text: string, record: any) => <span>{handleNumber(record.currency, text)}</span>
	},
	agentWithdrawalDetail_completeAmount: {
		align: "center",
		title: (
			<>
				{newFormat("funds.capital_adjustment.complete_valid_water")}
				<br />
				{newFormat("funds.capital_adjustment.withdraw_snoshop")}
			</>
		),
		dataIndex: "completeAmount",
		render: (text: string, record: any) => <span>{handleNumber(record.currency, text)}</span>
	},

	// table 7
	agentWithdrawalDetail_snapshotTine: {
		title: newFormat("funds.fund_audit.snapshot_time"),
		align: "center",
		dataIndex: "snapshotTine",
		render: (text: any) => text || "-"
	},
	agentWithdrawalDetail_teamNetAsset: {
		title: newFormat("funds.settlement_bill_management.team_assets"),
		align: "center",
		dataIndex: "teamNetAsset",
		render: (text: any, record: any) => (
			<span style={{ color: handleNumberColor(record.teamNetAsset) }}>{handleNumber(record.currency, record.teamNetAsset)}</span>
		)
	},
	agentWithdrawalDetail_teamShouldRepay: {
		title: newFormat("funds.settlement_bill_management.team_payable_loan"),
		align: "center",
		dataIndex: "teamShouldRepay",
		render: (text: any, record: any) => <span>{handleNumber(record.currency, record.teamShouldRepay)}</span>
	},
	agentWithdrawalDetail_teamWithdrawAmount: {
		title: newFormat("funds.settlement_bill_management.team_withdrawable_limit"),
		align: "center",
		dataIndex: "teamWithdrawAmount",
		render: (text: any, record: any) => <span>{handleNumber(record.currency, record.teamWithdrawAmount)}</span>
	},
	agentWithdrawalDetail_netAsset: {
		title: newFormat("funds.settlement_bill_management.bill_net_assets"),
		align: "center",
		dataIndex: "netAsset",
		render: (text: any, record: any) => <span>{handleNumber(record.currency, record.netAsset)}</span>
	},
	agentWithdrawalDetail_cash: {
		title: newFormat("member.balance"),
		align: "center",
		dataIndex: "cash",
		render: (text: any, record: any) => <span>{handleNumber(record.currency, record.cash)}</span>
	},
	agentWithdrawalDetail_creditAvailable: {
		title: newFormat("member.credit_balance"),
		align: "center",
		dataIndex: "creditAvailable",
		render: (text: any, record: any) => <span>{handleNumber(record.currency, record.creditAvailable)}</span>
	},
	agentWithdrawalDetail_creditTotal: {
		title: newFormat("funds.fund_audit.credit_limit"),
		align: "center",
		dataIndex: "creditTotal",
		render: (text: any, record: any) => <span>{handleNumber(record.currency, record.creditTotal)}</span>
	},

	// dialog table
	agentWithdrawalDetail_createDt: {
		title: newFormat("funds.fund_audit.register_time"),
		dataIndex: "createDt",
		align: "center",
		render: (text: string) => text || "-"
	},
	agentWithdrawalDetail_deviceNoDialog: {
		title: newFormat("funds.fund_audit.register_device_no"),
		dataIndex: "deviceNo",
		align: "center",
		render: (text: string) => text || "-"
	},
	agentWithdrawalDetail_depositAmount: {
		title: newFormat("funds.fund_audit.deposit_amount"),
		dataIndex: "depositAmount",
		align: "center",
		render: (text: number, record: any) => handleNumber(record.currency, text + "")
	},
	agentWithdrawalDetail_withdrawAmountDialog: {
		title: newFormat("funds.fund_audit._order_amount"),
		dataIndex: "withdrawAmount",
		align: "center",
		render: (text: number, record: any) => handleNumber(record.currency, text + "")
	},
	agentWithdrawalDetail_registerIp: {
		title: newFormat("funds.fund_audit.register_ip"),
		dataIndex: "registerIp",
		align: "center"
	}
})

export default AgentWithdrawalReviewRecordColumns
